package TestCases;

import java.util.Map;
import org.slf4j.LoggerFactory;
import com.crc.mam.BaseCase;
import coms.AutoException;
import coms.process.LoginTest;
import coms.process.Todo;
import frame.InterTest;

public class AuditProcessTestcase extends BaseCase implements InterTest {
  private static org.slf4j.Logger logger = LoggerFactory.getLogger(AuditProcessTestcase.class); 


  @Override
  public void run(Map<Object, Object> paramMap) {
    
    String amountString = (String) paramMap.get("amount");
    float amount = Float.valueOf(amountString);
    logger.info("amount : " + amount );
    String claimId = (String) paramMap.get("claimId");
    String claimNo = (String) paramMap.get("claimNum");
    
    /**
      * 高俊审批
      */ 
   LoginTest loginTest = new LoginTest();
   String userCode = "hailian";
   paramMap.put("userCode", "hailian");
   paramMap.put("password","123456");
   loginTest.run(paramMap);
   if(!loginTest.status) {
     remark = loginTest.remark;
     status = false;
     throw new AutoException("登录失败，阻碍测试");
   }
   Todo todo = new Todo();
   todo.run(paramMap);
   if(!todo.status) {
     remark = todo.remark;
     status = false;
     throw new AutoException("审核人：审批失败，阻碍测试");
   }
   /**
    * 安卫东 审批
    */
   paramMap.put("userCode", "guanfa");
   paramMap.put("password","123456");
   loginTest.run(paramMap);
  
   todo.run(paramMap);
 
   /**
    * 李炳南 业务财务 审批
    */
   paramMap.put("userCode", "jiangwu");
   paramMap.put("password","123456");
   loginTest.run(paramMap);
  
   todo.run(paramMap);
 
   /**
    * 孙丰云 财务负责人 审批 < 1W
    */
   if(amount <10000) {
       paramMap.put("userCode", "linpeng");
       paramMap.put("password","123456");
       loginTest.run(paramMap);
      
       todo.run(paramMap);
   }else {
     
     /**金额大于1W，财务经理审批
      * 
      */
     paramMap.put("userCode", "zhuyi");
     paramMap.put("password","123456");
     loginTest.run(paramMap);
    
     todo.run(paramMap);
   }
   
   /**
    * 段夏梦 公司领导 审批
    */
   paramMap.put("userCode", "tanglu");
   paramMap.put("password","123456");
   loginTest.run(paramMap);
 
   todo.run(paramMap);
 
  
  }


  @Override
  public boolean getStatus() {
    // TODO Auto-generated method stub
    return false;
  }


  @Override
  public String getRemark() {
    // TODO Auto-generated method stub
    return null;
  }
  

}
